import logging
from littlesite.custom_reactor import install
install()

class Config:
    def __init__(self):
        self.__dict__ = {}

    def _update(self, module):
        for name in dir(module):
            if name.startswith('_'):
                continue
            self.__dict__[name] = getattr(module, name)

config = None

def rebuildConfig():
    logging.debug('rebuilding config')

    global config
    config = Config()

    base_config = __import__('littlesite.base_config', fromlist=['littlesite'])
    config._update(base_config)

    local_config = __import__('local_config')
    config._update(local_config)


rebuildConfig()
